convert object to httpcontent c#

98

convert object to httpcontent c# -

//from string
ByteArrayContent content = new StringContent(jData);

//from any other object
string myContent = JsonConvert.SerializeObject(data);
ByteArrayContent content = new StringContent(jBalances);

content.Headers.ContentType = new MediaTypeHeaderValue(MediaTypeNames.Application.Json);

var result = await client.PostAsync("", content).ConfigureAwait(false);

Comments

Submit
0 Comments